#ifndef __MY_EXCEPTION_H_
#define __MY_EXCEPTION_H_

class myException {

	private:
		int m_iLineNo;
		char m_cFileName[100];
		char* m_cMessage;
	public:
		int createException(int _iLineNo, char* _cFileName, const char* _cMsg)
		{
			
			m_iLineNo = _iLineNo;
			
			if(_cFileName) strcpy(m_cFileName, _cFileName);
			else strcpy(m_cFileName, "Filename Unkown");

			if(_cMsg) 
			{
				m_cMessage = new char[strlen(_cMsg)+1];
				//assert(m_cMessage);
				if(m_cMessage)strcpy(m_cMessage, _cMsg);
			}
			else {
				m_cMessage = new char[strlen("Default Message")+1];
			//	assert(m_cMessage);
				if(m_cMessage) strcpy(m_cFileName, "Default Message");
				else
				{
				 printf("\n to do");  
				}
			}
		return 0;
		}

		void printAndAbort()
		{
			cout<<endl;
			cout<<"*** Exception Handler invoked ***"<<endl;
			cout<<m_cFileName << ":"<<m_iLineNo <<endl<<m_cMessage;
			abort();
		}
		

};

#endif

